document.write("<link rel=\"stylesheet\" href=\"../../css/dialog/dialog.css\" />");
document.write("<script type=\"application/javascript\" src=\"../../js/jquery/jquery-1.9.1.min.js\"></script>");
document.write("<script type=\"application/javascript\" src=\"../../js/dialog/zepto.min.js\"></script>");
document.write("<script type=\"application/javascript\" src=\"../../js/dialog/dialog.js\"></script>");
var dialogs = [];
var wx={
	showLoading:function(option){
		var dialog = $(document).dialog({
			type:'toast',
			infoIcon:'../../images/loading.gif',
			infoText:option.title?option.title:"加载中..."
		});
		dialogs.push(dialog);
	},
	hideLoading:function(){
		if(dialogs.length==0)return;
		var dialog = dialogs.shift();
		dialog.close();
	},
	showToast:function(option){
		$(document).dialog({
			type:'notice',
			infoText:option.title,
			autoClose:2000,
			position:'center'
		});
	},
	showModal:function(option){
		$(document).dialog({
			type:'confirm',
			titleText:option.title,
			position:'center',
			content:option.content,
			buttonTextConfirm:"确定",
			buttonTextCancel:"取消",
			onClickConfirmBtn:option.confirm,
		});
	},
	setStorageSync: function(key, val){
		localStorage.setItem(key, val);
	},
	getStorageSync: function(key){
		return localStorage.getItem(key);
	}, 
	getStorage: function(option){
		if(!option || !option.key || !window.localStorage || !localStorage.getItem(option.key)){
			if(option.fail){
				option.fail();
			}
		}else if(option.success){
			option.success(localStorage.getItem(option.key));
		}
		if(option.complete){
			option.complete();
		}
	}
}
